#include "common.h"
S4B Detach(U4B pid)
{
   PPROCESS ppro=process;
   while(ppro!=PTR_INVALID && ppro->p_pid!=pid &&ppro->p_pprocessnext!=process)
   { 
      ppro=ppro->p_pprocessnext;
   }

   if(ppro==PTR_INVALID || ppro->p_pid!=pid) 
   { return ARTIST_ERROR_PROCESSNOTEXIST;}
   
   ppro->p_pprocessprev->p_pprocessnext=ppro->p_pprocessnext;
   ppro->p_pprocessnext->p_pprocessprev=ppro->p_pprocessprev; 
   return ARTIST_ERROR_OK;
}

S4B DetachProcess(U4B pid)
{ 
    S4B value;
    SystemCallInterrupt((U4B)SYSCALL_DETACH,(U4B)pid,NULL,(U4B)&value);
    return value;
}
